Skip to main content

Example API Call

Understanding the Module, Record and Reference ID

When an app is created in UniFi, it acquires a module ID. This is a unique identifier that is used to refer to that app. Likewise, when a transaction is started it also acquires an ID which uniquely identifies it. If you select an app from the side menu the URL displayed at the top of the screen contains the Module ID for that app. An example URL would look like:

https://demo.unifiplatform.com/module/db6bc4c576b94c84bc130ce5d8dcae54?from=sidebar

The format of the URL breaks down to:

https://<customer_account>.unifiplatform.com/module/<module_id>?from=sidebar

So in this example, the customer account is 'demo' and the module ID is 'db6bc4c576b94c84bc130ce5d8dcae54'. The first part (i.e. https://<customer_account>.unifiplatform.com) is the same for throughout UniFi and is known as the base URL)

Similarly if you select a completed transaction you will see a URL in the format:

https://demo.unifiplatform.com/item-editor/db6bc4c576b94c84bc130ce5d8dcae54/2b37ad7346b34b4cabeb3431244bdd18/edit?from=datatable

In this case the URL contains both the module ID and the ID of the individual record as follows:

https://<customer_account>.unifiplatform.com/item-editor/<module_id>/<record_id>/edit?from=datatable

So we have the same customer and module ID as previously, but the record ID in this case is '2b37ad7346b34b4cabeb3431244bdd18'.

info

If you view a transaction that is in-progress you will also see a third reference, the instance ID. This is a unique identifier for the step that the transaction is currently at in the process.

Similarly, if you select an item from the list of reference data available, the URL will give you the reference data ID. In this case the format is:

https://<customer_id>.unifiplatform.com/referencedata/<reference_data_id>?from=datatable`

Viewing a Transaction via the API

The API call to get the transactional detail is as follows:

ItemValues Required
URL (after base)api/entrymodule/<record_id>/detail
MethodGET
Parametersmoduleid: <module_id>
Headersx-api-key: <API Key>
Accept: */*

Entering these details into an API testing tool such as https://www.postman.com but using values identified from your UniFi system should produce some JSON similar to this:

{
"success": true,
"message": null,
"data": {
"id": "2b37ad7346b34b4cabeb3431244bdd18",
"created_by": "2514f7d3f01f42c49698c9fa8b08ee08",
"created_on": "2022-01-11T07:39:53.668849",
"modified_by": "2514f7d3f01f42c49698c9fa8b08ee08",
"modified_on": "2022-01-11T07:40:32.202952",
"is_active": true,
"is_locked": true,
"is_default": null,
"owner_id": "2514f7d3f01f42c49698c9fa8b08ee08",
"organization_id": "de8ebd045ee8414e8b64887979b392e9",
"entity_id": "ec42a6b23eaf489e80f9159540e2bd64",
"transaction_id": "4FECF3D99B654D50AB9740E87E1E6881",
"workflow_instance_id": "fbd62bd7f5df4a73816430aa3eb6912c",
"workflow_started_on": "2022-01-11T07:40:04.106191",
"workflow_completed_on": "2022-01-11T07:40:41.855867",
"workflow_faulted_on": null,
"workflow_status": "Completed",
"assigned_to": null,
"user_field_1": "value 1",
"user_field_2": "value 2",
...
}
}

Where the user_field_1 etc are pairs of field ID's and the values contained in them from the app form. The data above this is system data and may be useful to ascertain things like when a transaction was created etc.

warning

When data related to an individual record is returned from the UniFi API, it is usually described as just the 'id' not the 'record_id'. You can see in the above example that the 'id' field corresponds to the record ID that we send in the request.